package com.damieoa.damieoa.controller;

import com.damieoa.damieoa.pojo.Statement;
import com.damieoa.damieoa.service.StatementService;
import com.damieoa.damieoa.vo.PageUtils;
import com.damieoa.damieoa.vo.SysResult;
import com.github.pagehelper.ISelect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
@Transactional
@RequestMapping("/statement")
public class StatementController {

    @Autowired
    private StatementService statementService;

    //查询新聘员工
    @GetMapping("/staff")
    public SysResult queryNewStaff(Statement statement) {
        return SysResult.success(PageUtils.startPage().doSelectPageInfo(new ISelect() {
            @Override
            public void doSelect() {
                statementService.queryNewStaff(statement);
            }
        }));
    }

    //离职员工统计
    @GetMapping("/dimission")
    public SysResult dimissionStaff(Statement statement) {
        return SysResult.success(PageUtils.startPage().doSelectPageInfo(new ISelect() {
            @Override
            public void doSelect() {
                statementService.dimissionStaff(statement);
            }
        }));
    }

    //查询部门调动员工
    @GetMapping("/department")
    public SysResult departmentStaff(Statement statement) {
        return SysResult.success(PageUtils.startPage().doSelectPageInfo(new ISelect() {
            @Override
            public void doSelect() {
                statementService.departmentStaff(statement);
            }
        }));
    }

    //查询岗位调动员工
    @GetMapping("/station")
    public SysResult stationStaff(Statement statement){
        return SysResult.success(PageUtils.startPage().doSelectPageInfo(new ISelect() {
            @Override
            public void doSelect() {
                statementService.stationStaff(statement);
            }
        }));
    }

}
